<?php

namespace app\common\util\jsonscm;

use Opis\JsonSchema\{
    Validator,
    Errors\ErrorFormatter,
};

class ImageRecordsValidator extends JsonScmValidator
{
    /**
     * 相册列表json-schema，通过apifox生成
     */
    protected static $schema = <<<'JSON'
    {
        "anyOf": [
            {
                "type": "object",
                "additionalProperties": false,
                "x-apifox-orders": [
                    "version",
                    "entities"
                ],
                "properties": {
                    "version": {
                        "type": "string",
                        "title": "版本号",
                        "description": "固定为“v1”，v1版本产品相册",
                        "const": "v1"
                    },
                    "entities": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string",
                                    "description": "相册名"
                                },
                                "url": {
                                    "type": "string",
                                    "description": "相册url"
                                }
                            },
                            "x-apifox-orders": [
                                "name",
                                "url"
                            ],
                            "required": [
                                "name",
                                "url"
                            ]
                        },
                        "description": "相关实体数组"
                    }
                },
                "required": [
                    "version",
                    "entities"
                ]
            }
        ],
        "description": "产品相册,用JSON数组保存",
        "title": "相册"
    }
    JSON;
}